/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package reamodel.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

import reamodel.DecrementCommitment;
import reamodel.IncrementCommitment;
import reamodel.IncrementEconomicEvent;
import reamodel.IncrementEconomicEventType;
import reamodel.ReamodelPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Increment Commitment</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link reamodel.impl.IncrementCommitmentImpl#getSpecify <em>Specify</em>}</li>
 *   <li>{@link reamodel.impl.IncrementCommitmentImpl#getFulfill <em>Fulfill</em>}</li>
 *   <li>{@link reamodel.impl.IncrementCommitmentImpl#getReciprocity <em>Reciprocity</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class IncrementCommitmentImpl extends CommitmentImpl implements IncrementCommitment {
	/**
	 * The cached value of the '{@link #getSpecify() <em>Specify</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSpecify()
	 * @generated
	 * @ordered
	 */
	protected EList<IncrementEconomicEventType> specify;

	/**
	 * The cached value of the '{@link #getFulfill() <em>Fulfill</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFulfill()
	 * @generated
	 * @ordered
	 */
	protected EList<IncrementEconomicEvent> fulfill;

	/**
	 * The cached value of the '{@link #getReciprocity() <em>Reciprocity</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getReciprocity()
	 * @generated
	 * @ordered
	 */
	protected EList<DecrementCommitment> reciprocity;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IncrementCommitmentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ReamodelPackage.Literals.INCREMENT_COMMITMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<IncrementEconomicEventType> getSpecify() {
		if (specify == null) {
			specify = new EObjectResolvingEList<IncrementEconomicEventType>(IncrementEconomicEventType.class, this, ReamodelPackage.INCREMENT_COMMITMENT__SPECIFY);
		}
		return specify;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<IncrementEconomicEvent> getFulfill() {
		if (fulfill == null) {
			fulfill = new EObjectWithInverseResolvingEList.ManyInverse<IncrementEconomicEvent>(IncrementEconomicEvent.class, this, ReamodelPackage.INCREMENT_COMMITMENT__FULFILL, ReamodelPackage.INCREMENT_ECONOMIC_EVENT__FULFILL);
		}
		return fulfill;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<DecrementCommitment> getReciprocity() {
		if (reciprocity == null) {
			reciprocity = new EObjectWithInverseResolvingEList.ManyInverse<DecrementCommitment>(DecrementCommitment.class, this, ReamodelPackage.INCREMENT_COMMITMENT__RECIPROCITY, ReamodelPackage.DECREMENT_COMMITMENT__RECIPROCITY);
		}
		return reciprocity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ReamodelPackage.INCREMENT_COMMITMENT__FULFILL:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getFulfill()).basicAdd(otherEnd, msgs);
			case ReamodelPackage.INCREMENT_COMMITMENT__RECIPROCITY:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getReciprocity()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ReamodelPackage.INCREMENT_COMMITMENT__FULFILL:
				return ((InternalEList<?>)getFulfill()).basicRemove(otherEnd, msgs);
			case ReamodelPackage.INCREMENT_COMMITMENT__RECIPROCITY:
				return ((InternalEList<?>)getReciprocity()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ReamodelPackage.INCREMENT_COMMITMENT__SPECIFY:
				return getSpecify();
			case ReamodelPackage.INCREMENT_COMMITMENT__FULFILL:
				return getFulfill();
			case ReamodelPackage.INCREMENT_COMMITMENT__RECIPROCITY:
				return getReciprocity();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ReamodelPackage.INCREMENT_COMMITMENT__SPECIFY:
				getSpecify().clear();
				getSpecify().addAll((Collection<? extends IncrementEconomicEventType>)newValue);
				return;
			case ReamodelPackage.INCREMENT_COMMITMENT__FULFILL:
				getFulfill().clear();
				getFulfill().addAll((Collection<? extends IncrementEconomicEvent>)newValue);
				return;
			case ReamodelPackage.INCREMENT_COMMITMENT__RECIPROCITY:
				getReciprocity().clear();
				getReciprocity().addAll((Collection<? extends DecrementCommitment>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ReamodelPackage.INCREMENT_COMMITMENT__SPECIFY:
				getSpecify().clear();
				return;
			case ReamodelPackage.INCREMENT_COMMITMENT__FULFILL:
				getFulfill().clear();
				return;
			case ReamodelPackage.INCREMENT_COMMITMENT__RECIPROCITY:
				getReciprocity().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ReamodelPackage.INCREMENT_COMMITMENT__SPECIFY:
				return specify != null && !specify.isEmpty();
			case ReamodelPackage.INCREMENT_COMMITMENT__FULFILL:
				return fulfill != null && !fulfill.isEmpty();
			case ReamodelPackage.INCREMENT_COMMITMENT__RECIPROCITY:
				return reciprocity != null && !reciprocity.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //IncrementCommitmentImpl
